package com.rzx.mybackend.utils;

import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

/**
 * RabbitMQUtils
 *
 * @author renzhexian
 * @date 2025/9/15
 */
@Component
@RequiredArgsConstructor
public class RabbitMQUtils {

    private final RabbitTemplate rabbitTemplate;
    /**
     * 发送消息
     *
     * @param exchange       交换机
     * @param routingKey     路由键
     * @param message        消息
     */
    public void sendMessage(String exchange, String routingKey, Object message) {
        rabbitTemplate.convertAndSend(exchange, routingKey, message);
    }
}
